Prevent concurrent use of GTK+ 2 and 3
authorMatthias Clasen <mclasen@redhat.com>
Sat, 19 Jun 2010 02:27:26 +0000 (22:27 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 19 Jun 2010 02:27:26 +0000 (22:27 -0400)
If we detect a gtk2-only symbol, error out early.

gtk/gtkmain.c

index 017d000de1402df42f1619029fdb3ed17ffce00f..22206587f861b45a29950d377badd5a5b8967d0b 100644 (file)
@@ -607,6 +607,22 @@ setlocale_initialization (void)
     }
 }
 
+static void
+check_mixed_deps (void)
+{
+  GModule *module;
+  gpointer func;
+
+  module = g_module_open (NULL, 0);
+
+  if (g_module_symbol (module, "gtk_progress_get_type", &func))
+    {
+      g_error ("GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported");
+    }
+
+  g_module_close (module);
+}
+
 static void
 do_pre_parse_initialization (int    *argc,
                             char ***argv)
@@ -618,6 +634,8 @@ do_pre_parse_initialization (int    *argc,
 
   pre_initialized = TRUE;
 
+  check_mixed_deps ();
+
   gdk_pre_parse_libgtk_only ();
   gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL);